package com.ming.service;

import com.ming.dao.UserMapper;
import com.ming.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by Administrator on 2017/6/14.
 */

@Service("UserService")
public class UserServiceImp implements UserService{
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> selectAllUser() {
        return userMapper.selectAllUser();
    }

    @Override
    public User selectOneUserById(int id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateOneUser(User user) {

        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public int deleteOneUser(int id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int addOneUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public List<User> selectByWord(User user) {

        return  userMapper.selectByWord(user);
    }

        @Override
    public List<User> selectUserByPage(Integer pageOffset, Integer pageSize) {
        return userMapper.selectUserByPage(pageOffset,pageSize);
    }

    @Override
    public int allPages() {
        return userMapper.allPages();
    }


}
